The present invention relates to method of operating flash memory for persistent storage of data.
The Internet has rapidly become the new standard for world-wide communication and data distribution. Someone looking for information on just about any subject will likely be able to find it somewhere on the web. There are millions of pages on the web, containing a wide spectrum of information including the latest news and sports, stock market information, research information on just about any subject, etc. In addition to providing a wealth of information, the Internet allows users to actively participate in a dynamic, ever-changing environment. For instance, the Internet allows people from around the world to discuss politics, play computer games, participate in chat room conversations, and sell goods. The use of the Internet has been expanding exponentially, and is expected to continue to do so for years to come. The increase in the number of web users naturally leads to the creation of more home pages, which contain information of interest to even more users, resulting in a self-perpetuating cycle of growth.
Simply put, the Internet provides a vast array of resources that just about everyone would like to be able to access. However, in order to access the Internet the user needs to have the appropriate hardware, which generally includes a computer, a monitor, a modem, and a connection (generally over a phone line) to an Internet service provider (ISP). Even with the large reductions in the price of computer hardware, the cost of an Internet-capable computer is out-of-reach for most of the world""s populous.
One solution to lowering the cost of Internet access is to access the web using an Internet xe2x80x9cset-topxe2x80x9d box and a television set. Such a concept is used by xe2x80x9cWebTVxe2x80x9d(copyright). WebTV(copyright) uses a processor-based set-top box that connects to an ISP over a phone line, cable, or satellite connection, and provides video signals to drive conventional television screens. In addition, the set-top box has built-in communication circuitry and provides enough computing power to allow a user to surf the web by simply clicking a few buttons on a keyboard or remote control. Since most people in the United States (and billions elsewhere) already have access to television sets, the cost for connecting to the Internet with such a product is primarily the cost of the set-top box (which is much less than the cost of a computer) and the WebTV(copyright) ISP service charge.
Although the WebTV(copyright) concept was a cost breakthrough, it still has drawbacks. One of the drawbacks is that a WebTV(copyright) user must connect to the Internet via a special WebTV(copyright) ISP. While this is no problem in largely populated areas, it becomes an issue in more rural areas, and is a significant problem when considering servicing populations outside of the U.S. Another drawback is that the WebTV(copyright) set-top boxes provide only limited provisions for storing most user-specific data, such as user preferences and communication settings. For instance, it is desirable to be able to store a list of favorite website addresses to allow the user to easily return to these sites. Since the WebTV(copyright) set-top boxes have only limited provisions for storing user-specific data, this user preference data is stored on WebTV(copyright) database servers, which are only accessible through the WebTV ISPs. It would be preferable to store the user-specific data in the set-top box itself so that there is no need to use WebTV(copyright) ISPs or the WebTV(copyright) databases.
If user-specific data is to be stored in the set-top box then it must be stored in a non-volatile mannerxe2x80x94that is, it must be retained (persist) when power is removed from the set-top box. The most common way to store persistent data is with a fixed-disk medium, such as a computer hard disk drive. However, a hard disk drive is relatively expensive, and may not be suitable to meet the cost, size, reliability, and ruggedness requirements of such a product. Thus, there is a need for a rugged, reliable, low cost persistent storage device for storing user preferences and other user-specific data on a set-top box device.
A preferred embodiment of the invention fulfills this need by providing a persistent non-volatile storage system called a xe2x80x9cflash storexe2x80x9d that provides a simple, low-overhead mechanism for storing information, such as user preferences. The flash store comprises two or more sectors of non-volatile memory, including an active sector and one or more non-active backup sectors. By xe2x80x9cping-pongingxe2x80x9d data between the active sector and the backup sector(s), the flash store is able to delete records from the store while maintaining a non-volatile copy of the data. The system is resistant to corruption, and can survive a power failure at any point during a write operation without risk of losing information. The system requires little RAM or other system resources, making it ideal for use in resource-restricted environments, such as Internet set-top boxes.
The illustrated flash store comprises two or more sectors of non-volatile flash memory, including an active sector and one more backup sectors. Each sector has a header that includes a signature value and three status bits. The combinations of the signature value and the status bits indicate whether the sector has been properly initialized, whether the sector is an active or non-active sector (available or not available to receive data), or whether the sector is invalid (may contain invalid data).
Each active sector comprises a plurality of data records, wherein each data record has a record header associated with it. Each record header includes two status bits, a size field, a key ID field, and a next record offset field. The status bits indicate whether the record is a valid, an active record, a deleted record, an invalid record, or a null record.
The key ID field is used to create a link-listed file structure. Data records that pertain to a given subject matter share a common key ID value. These records are listed by their common key ID values and the next record offset value, such that the next record offset value points to the next record in the linked list.
A key ID with a value of 0 is a special key ID for mapping the other key ID""s to string variable names (keys) in an application program or operating system that employs the flash store. For instance, a first key ID 0 record may identify that key ID 1 records are associated with registry data, while key ID 2 records are associated with cookie data, etc.
An application program or operating system can communicate with and control operation of the flash store by using a set of API calls. Each API call contains one or more input parameters and provides a return value. For example, the API calls may be used to delete records, retrieve records, create and delete key ID""s, create records, etc.
The foregoing and other features of the invention will be more readily apparent from the following detailed description which proceeds with reference to the accompanying drawings.